﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NHyperV
{
    public enum EnabledState : ushort
    {
        Unknown = 0,            // The state of the VM could not be determined. 
        Enabled = 2,            // The VM is running.
        Disabled = 3,           // The VM is turned off.
        Paused = 32768,         // The VM is paused. 
        Suspended = 32769,      // The VM is in a saved state.
        Starting = 32770,       // The VM is starting. This is a transitional state between 3 (Disabled) or 32769 (Suspended) and 2 (Enabled) initiated by a call to the RequestStateChange method with a RequestedState parameter of 2 (Enabled).
        Snapshotting = 32771,   // This value is supported and indicates the VM is performing a snapshot operation.
        Saving = 32773,         // The VM is saving its state. This is a transitional state between 2 (Enabled) and 32769 (Suspended) initiated by a call to the RequestStateChange method with a RequestedState parameter of 32769 (Suspended).
        Stopping = 32774,       // The VM is turning off. This is a transitional state between 2 (Enabled) and 3 (Disabled) initiated by a call to the RequestStateChange method with a RequestedState parameter of 3 (Disabled) or a guest operating system initiated power off.
        Pausing = 32776,        // The VM is pausing. This is a transitional state between 2 (Enabled) and 32768 (Paused) initiated by a call to the RequestStateChange method with a RequestedState parameter of 32768 (Paused).
        Resuming = 32777,       // The VM is resuming from a paused state. This is a transitional state between 32768 (Paused) and 2 (Enabled).
    }

    public enum RequestedState : ushort
    {
        Enabled = 2,            // Turns the VM on.
        Disabled = 3,           // Turns the VM off. 
        Reboot=10,              // A hard reset of the VM. 
        Reset=11,               // For future use. 
        // DMTF_Reserved=13–32767 Reserved. 
        Paused=32768,           // Pauses the VM. 
        Suspended=32769,        // Saves the state of the VM. 
        // Vendor_Reserved=32770–65535 Reserved. 

    }

    public enum RequestedStateReturnValue: uint
    {
        Completed_with_No_Error = (0),
        // DMTF Reserved (7–4095),
        Method_Parameters_Checked_Transition_Started = (4096),
        Failed = (32768),
        Access_Denied = (32769),
        Not_Supported = (32770),
        Status_is =  (32771),
        Timeout = (32772),
        Invalid_parameter = (32773),
        System_is_in_use = (32774),
        Invalid_state_for_this_operation = (32775),
        Incorrect_data_type = (32776),
        System_is_not_available = (32777),
        Out_of_memory = (32778),
    }

    public enum HealthState : ushort
    {
        OK = 5,                 // The VM is fully functional and is operating within normal operational parameters and without error.
        Major_Failure = 20,     // The VM has suffered a major failure. This value is used when one or more disks containing the VM's VHDs is low on disk space and the VM has been paused. 
        Critical_failure = 25,  // The element is nonfunctional, and recovery might not be possible. This can indicate that the worker process for the VM (Vmwp.exe) is not responding to control or information requests, or that one or more disks containing the VHDs for the VM are low on disk space.
    }

    public enum OperationalStatus : ushort
    {
        OK = 2,                 // The VM is functional and operating normally.
        Degraded = 3,           // The VM is only partially functional. This indicates that the storage containing the configuration is not accessible. A VM in this state may only be turned off or deleted. 
        Predictive_Failure = 5, // The VM is functional but may fail in the future. This indicates that the storage containing the VM's virtual hard disks is low on free space. The VM will be paused if more disk space is not made available. 
        Stopped = 10,           //This value is not supported. If the VM is stopped, the EnabledState property will have a value of 3 (Disabled).
        In_Service = 11,        // The VM is processing a request.
        Dormant = 15,           // This value is not supported. If the VM is suspended or paused, the EnabledState property will have a value of 32769 (Suspended) or 32768 (Paused).
    }

}
